# Contributor: Luca Weiss <luca@z3ntu.xyz>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=libayatana-appindicator
pkgver=0.5.91
pkgrel=0
pkgdesc="Ayatana Application Indicators Shared Library"
url="https://github.com/AyatanaIndicators/libayatana-appindicator"
arch="all !s390x" # tests fail on builders
license="LGPL-3.0-only"
makedepends="
	cmake
	dbus-glib-dev
	glib-dev
	gobject-introspection-dev
	gtk+3.0-dev
	libayatana-indicator-dev
	libdbusmenu-gtk3-dev
	vala
	"
checkdepends="dbus-test-runner xvfb-run"
subpackages="$pkgname-dev"
source="https://github.com/AyatanaIndicators/libayatana-appindicator/archive/$pkgver/libayatana-appindicator-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DENABLE_TESTS=ON \
		-DENABLE_BINDINGS_MONO=OFF \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
cc8631814c881640bf2de91a43205c3405fd1fefcd7d58f259171d0926bf7ab08f9361076f4eea1dd8876e8931f9c9230babd3a328f34dc298bc9c4ff004f8ee  libayatana-appindicator-0.5.91.tar.gz
"
